//创建路由器并转发

//引入路由
import { createRouter, createWebHistory,createWebHashHistory } from "vue-router";
//引入模块
import About from '@/pages/About.vue';
import Home from "@/pages/Home.vue";
import Comment from "@/pages/Comment.vue";
import   Detail from "@/pages/Detail.vue";

const router = createRouter({
    //有createWebHistory和createWebHashHistory两种
    history: createWebHistory(),
    routes: [
        {
            path: '/home',
            component: Home
        },
        {
            path: '/about',
            component: About
        },
        {
            path: '/comment',
            name: 'page1',
            component: Comment,
            children:[
                
                    {
                        name:'xiang',
                        path:'detail/:id/:name/:link?', //站位符号 ？代表有和没
                        component:Detail
                    }
                
            ]
        }
    ]
})

export default router;